﻿<!DOCTYPE HTML>
<html>
<head>
<#include "/script.ftl">
<link rel="stylesheet" type="text/css" href="../static/eth/css/customer.css" />
<script type="text/javascript" src="../lib/layer/2.1/layer.js"></script>
<title>用户详情</title>
<style>
	.info{font-size: 24px ;margin: 20px;font-weight: 600;border-bottom: 2px solid #7fbcdf;padding-bottom: 20px;
}
</style>
</head>
<body id="body" class="common_body">
	<nav class="breadcrumb">
		<i class="Hui-iconfont">&#xe67f;</i> 首页
		<span class="c-gray en">&gt;</span>账户
		<span class="c-gray en">&gt;</span> 账户信息
	</nav>
	<div class="page-container">
		<div class="customer_box1">
			<form id="form" class="form form-horizontal" action="save" autocomplete="off">
				<input type="hidden" name="userId" value="${user.userId!}">
				<input type="hidden" name="userName" value="${user.userName!}">
				<input type="hidden" name="userCode" value="${user.userCode!}">
				<div class="info">
					帐号信息
				</div>
				<div class=" customer_line">
					<div class="row cl"  >
						<label class="form-label col-xs-4 col-sm-4">公司全称</label>
						<div class="formControls col-xs-2 col-sm-2">
							<input type="text"  value="${(user.agent.agentName)!}" disabled class="input-text common_body">
						</div>
						<label class="form-label col-xs-4 col-sm-1">手机号</label>
						<div class="formControls col-xs-2 col-sm-5">
							<input type="text" name="phone" value="${user.phone!''}" id="phone" class="input-text common_body">
						</div>
					</div>	
				</div>
				<div class=" customer_line">
					<div class="row cl"  >
						<label class="form-label col-sm-4">用户名</label>
						<div class="formControls col-sm-2">
							<input type="text" name="userCode" value="${user.userCode!''}" disabled class="input-text common_body">
						</div>
						<label class="form-label col-sm-1">授权Office</label>
						<div class="formControls col-sm-5">
							<input type="text" name="officeNo" value="${(user.agent.officeNo)!''}" disabled class="input-text common_body">
						</div>
					</div>
				</div>
				<div class="customer_line">
		  			<div class="row cl text-c">
		  				<input type="submit" value="保存" class="btn btn-primary radius">
		  				<input type="button" value="修改密码" onclick="update_password('<strong>修改密码</strong>','updatePasswordEdit?userId=${user.userId!}','800','270')" class="btn btn-primary radius">
		  			</div>
				</div>
			</form>
		</div>
	</div>
</body>
<script>
$(function(){
	$(".customer_head").on("click","span",function(){
		$(this).addClass("current_span").siblings().removeClass("current_span");
		$(".customer_content").hide().eq($(this).index()).show();
	});
	
	 // 手机号码验证    
    jQuery.validator.addMethod("isMobile", function(value, element) {    
      var length = value.length;    
      return this.optional(element) || (length == 11 && /^(((13[0-9]{1})|(14[0-9]{1})|(15[0-35-9]{1})|(17[0-9]{1})|(18[0-9]{1}))+\d{8})$/.test(value));    
    }, "请正确填写手机号码。");
		
	$("#form").validate({
		rules:{
			phone:{
				required : true,
				isMobile : true
			}
		},
		messages:{
			phone:{
				required : "请输入手机号",
				isMobile : "请输入11位有效的手机号"
			}
		},
		debug:true,
		onkeyup:false,
		focusCleanup:false,
		success:"valid",
		invalidHandler: function(form, validator) {return false;},
		submitHandler: function(form) {
			var json = $('#form').serialize();  
	        $.ajax({  
	          type : 'post',  
	          //contentType : 'application/json',  
	          url : 'updatePhone',
	          data : json, 
	          success : function(data) {
	        	  var rsult = jQuery.parseJSON(data);
	        	  if (rsult.success) {
	        		  alert("保存成功！");
	        		  window.parent.location.reload();
	        	  } else 
	        		  alert("保存失败!" + rsult.message);
	          },  
	          error : function(data) {  
	              alert("保存失败！")  
	          }  
	        });
	        return false;
		}
	});
})

//弹层函数
function order_edit(title,url,w,h){
		layer.close();
		var index = layer.open({
			type: 5,
			title: title,
			content: url,
		});
		layer.full(index);
}
function update_password(title,url,w,h){
	layer_show(title,url,w,h);	
}
</script>
</html>